package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import com.ysd.entity.GongSi;
import com.ysd.util.DBManager;

public class GongSiDaoImpl {
	public GongSi getGongSi() {
		Connection conn = DBManager.getConnection();
		Statement st = null;
		ResultSet rs = null;
		GongSi gongSi = null;
		try {
			st = conn.createStatement();
			rs = st.executeQuery("select * from GongSi");
			while(rs.next()) {
				String name =rs.getString("name");
				String wangZhan = rs.getString("wangZhan");
				String gongSiJieShao = rs.getString("gongSiJieShao");
				String phone = rs.getString("phone");
				String email = rs.getString("email");
				String diZhi = rs.getString("diZhi");
				String qiYeWenHua = rs.getString("qiYeWenHua");
				String logo = rs.getString("logo");
				gongSi = new GongSi(name, wangZhan, gongSiJieShao, phone, email, diZhi, qiYeWenHua, logo);
			}
			return gongSi;
		} catch (SQLException e) {
			// TODO 自动生成的 catch 块
			e.printStackTrace();
			return null;
		}
	}
}
